package cn.pegasus.teamwork.weixinpay;

import cn.iyizhan.teamwork.base.util.ReadPro;

public class Constant {
	/**
	 * 公众号AppId
	 */
	public static final String APP_ID = ReadPro.getValue("wx_appId").toString();

	/**
	 * 公众号AppId
	 */
	public static final String APP_ID_APP = ReadPro.getValue("app_wx_appId").toString();
	
	/**
	 * 公众号AppSecret 
	 */
	public static final String APP_SECRET = ReadPro.getValue("wx_appSecret").toString();
	
	
	public static final String APP_SECRET_APP = ReadPro.getValue("app_wx_appSecret").toString();
	
	/**
	 * 微信支付商户号
	 */
	public static final String MCH_ID_APP = ReadPro.getValue("app_wx_mch_id").toString();
	
	/**
	 * 公众号AppId
	 */
	public static final String APP_ID_WASHER = ReadPro.getValue("wx_appId_wahser").toString();

	/**
	 * 公众号AppSecret 
	 */
	public static final String APP_SECRET_WASHER = ReadPro.getValue("wx_appSecret_washer").toString();
	
	/**
	 * 微信支付商户号
	 */
	public static final String WASHER_MCH_ID = ReadPro.getValue("washer_mch_id").toString();
	
	
	/**
	 * 微信支付商户号
	 */
	public static final String MCH_ID = ReadPro.getValue("wx_mch_id").toString();

	/**
	 * 微信支付API秘钥
	 */
	public static final String KEY = ReadPro.getValue("wx_privateKey").toString();
	
	/**
	 * 微信支付API秘钥
	 */
	public static final String APP_KEY = ReadPro.getValue("wx_app_privateKey").toString();
	
	/**
	 * 微信支付API秘钥
	 */
	public static final String WASHER_KEY = ReadPro.getValue("wx_washer_privateKey").toString();

	/**
	 * 微信交易类型:公众号支付
	 */
	public static final String TRADE_TYPE_JSAPI = "JSAPI";
	
	/**
	 * 微信交易类型:公众号支付
	 */
	public static final String TRADE_TYPE_APP = "APP";
	

	/**
	 * WEB
	 */
	public static final String WEB = "WEB";
	
	/**
	 * WEB
	 */
	public static final String CREATEIP = ReadPro.getValue("wx_createip").toString();

	/**
	 * 返回成功字符串
	 */
	public static final String RETURN_SUCCESS = "SUCCESS";

	
	/**
	 * 微信统一下单url
	 */
	public static final String UNIFIED_ORDER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";
	
	/**
	 * 支付地址(包涵回调地址)
	 */

	public static final String REFUND_ORDER_URL = "https://api.mch.weixin.qq.com/secapi/pay/refund";
	
	/**
	 * 微信申请退款url
	 */
	public static final String REFUND_URL = ReadPro.getValue("wx_refund_url").toString();

	/**
	 * 微信充值通知url
	 */
	public static final String RENOTIFY_URL = ReadPro.getValue("wx_renotify_url").toString();
	
	/**
	 * 微信充值通知url
	 */
	public static final String DENOTIFY_URL = ReadPro.getValue("wx_denotify_url").toString();
	
	/**
	 * 微信购买通知url
	 */
	public static final String PUNOTIFY_URL = ReadPro.getValue("wx_punotify_url").toString();
	
	/**
	 * 微信购买通知url
	 */
	public static final String DTNOTIFY_URL = ReadPro.getValue("wx_dtnotify_url").toString();
	
	
	/**
	 * 证书位置  
	 */
	public static final String CERT_PATH = ReadPro.getValue("wx_certPath").toString();
	
	/**
	 * 证书位置  
	 */
	public static final String CERT_WASHER_PATH = ReadPro.getValue("wx_washer_certPath").toString();
	
	/**
	 * 证书位置  
	 */
	public static final String CERT_APP_PATH = ReadPro.getValue("wx_app_certPath").toString();

	/**
	 * 通过code获取授权access_token的URL
	 */
	public static String Authtoken_URL(String code) {
		StringBuffer url = new StringBuffer();
		url.append("https://api.weixin.qq.com/sns/oauth2/access_token?appid=");
		url.append(Constant.APP_ID);
		url.append("&secret=");
		url.append(Constant.APP_SECRET);
		url.append("&code=");
		url.append(code);
		url.append("&grant_type=authorization_code");
		return url.toString();
	}
}
